-- Decompiled with the Synapse X Luau decompiler.

local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.ModelObject());

local function worldCFrameToC0ObjectSpace(motor6DJoint,worldCFrame)
	local part1CF = motor6DJoint.Part1.CFrame
	local c1Store = motor6DJoint.C1
	local c0Store = motor6DJoint.C0
	local relativeToPart1 =c0Store*c1Store:Inverse()*part1CF:Inverse()*worldCFrame*c1Store
	relativeToPart1 -= relativeToPart1.Position
	
	local goalC0CFrame = relativeToPart1+c0Store.Position--New orientation but keep old C0 joint position
	return goalC0CFrame
end

function M.new(self, ...)
	assert(self, "param model is nil");
	return M(self, ...);
end;
local CallBackManager = CommonOHOH.load.CallBackManager();
function M.ctor(self, p3, ...)
	M.super.ctor(self, p3, ...);
	assert(self:GetHumanoid(), "model don't have humanoid");
	if self.OnDead then
		CallBackManager:AddRbxConnect(self, self:GetHumanoid_Check().Died, self.OnDead);
	end;
	self:GetHumanoid_Check();
end;
function M.dtor(self)
	M.super.dtor(self);
end;
function M.GetHumanoid(self)
	if self.humanoid then
		return self.humanoid;
	end;
	self.humanoid = self:WaitForChild("Humanoid");
	return self.humanoid;
end;
function M.GetHumanoid_Check(self)
	return self:WaitForChild_Check("Humanoid");
end;
function M.GetHumanoid_Loop(self)
	return self:WaitForChild_Loop("Humanoid");
end;
function M.GetHeight(self)
	return self:GetHumanoid_Check().HipHeight + self:GetRootPart_Check().Size.Y / 2;
end;
function M.SetAutoJumpEnabled(self, p10)
	if p10 == nil then
		p10 = false;
	end;
	self:GetHumanoid_Check().AutoJumpEnabled = p10;
end;
function M.IsAutoJumpEnabled(self)
	return self:GetHumanoid_Check().AutoJumpEnabled;
end;
function M.SetAutoRotate(self, p13)
	if p13 == nil then
		p13 = false;
	end;
	self:GetHumanoid_Check().AutoRotate = p13;
end;
function M.IsAutoRotate(self)
	return self:GetHumanoid_Check().AutoRotate;
end;
function M.GetWalkSpeed(self)
	return self:GetHumanoid_Check().WalkSpeed;
end;
function M.SetWalkSpeed(self, p17)
	assert(p17, "param speed is nil");
	self:GetHumanoid_Check().WalkSpeed = p17;
end;
function M.SetBreakJointsOnDeath(self, p19)
	if p19 == nil then
		p19 = false;
	end;
	self:GetHumanoid_Check().BreakJointsOnDeath = p19;
end;
function M.IsBreakJointsOnDeath(self)
	return self:GetHumanoid_Check().BreakJointsOnDeath;
end;
function M.SetAutomaticScalingEnabled(self, p22)
	if p22 == nil then
		p22 = false;
	end;
	self:GetHumanoid_Check().AutomaticScalingEnabled = p22;
end;
function M.IsAutomaticScalingEnabled(self)
	return self:GetHumanoid_Check().AutomaticScalingEnabled;
end;
function M.SetCameraOffset(self, p25)
	assert(p25, "param offset is nil");
	self:GetHumanoid_Check().CameraOffset = p25;
end;
function M.GetCameraOffset(self)
	return self:GetHumanoid_Check().CameraOffset;
end;
local u4 = {
	OuterBox = 0, 
	InnerBox = 1, 
	[0] = "OuterBox",
	"InnerBox"
};
function M.SetCollisionType(self, p28)
	assert(p28, "param collision type is nil");
	local v2 = u4[p28];
	assert(v2, "no such collision type");
	self:GetHumanoid_Check().CollisionType = v2;
end;
function M.GetCollisionType(self)
	return u4[self:GetHumanoid_Check().CollisionType];
end;
local u5 = {
	Viewer = 0, 
	Subject = 1, 
	None = 2, 
	[0] = "Viewer",
	"Subject", "None"
};
function M.SetDisplayDistanceType(self, p31)
	assert(p31, "param distance type is nil");
	local v3 = u5[p31];
	assert(v3, "no such display distance type");
	self:GetHumanoid_Check().DisplayDistanceType = v3;
end;
function M.GetDisplayDistanceType(self)
	return u5[self:GetHumanoid_Check().DisplayDistanceType];
end;
function M.SetDisplayName(self, p34)
	assert(p34, "param name is nil");
	self:GetHumanoid_Check().DisplayName = p34;
end;
function M.GetDisplayName(self)
	return self:GetHumanoid_Check().DisplayName;
end;
function M.SetMaxHp(self, p37)
	assert(p37, "param max hp is nil");
	self:GetHumanoid_Check().MaxHealth = p37;
end;
function M.GetMaxHp(self)
	return self:GetHumanoid_Check().MaxHealth;
end;
function M.SetHp(self, p40)
	assert(p40, "param hp is nil");
	self:GetHumanoid_Check().Health = p40;
end;
function M.GetHp(self)
	return self:GetHumanoid_Check().Health;
end;
function M.SetHealthDisplayDistance(self, p43)
	self:GetHumanoid_Check().HealthDisplayDistance = p43;
end;
function M.GetHealthDisplayDistance(self)
	return self:GetHumanoid_Check().HealthDisplayDistance;
end;
local u6 = {
	DisplayWhenDamaged = 0, 
	AlwaysOn = 1, 
	AlwaysOff = 2, 
	[0] = "DisplayWhenDamaged",
	"AlwaysOn", "AlwaysOff"
};
function M.SetHealthDisplayType(self, p46)
	assert(p46, "param displayer type is nil");
	local v4 = u6[p46];
	assert(v4, "no such health display type");
	self:GetHumanoid_Check().HealthDisplayType = v4;
end;
function M.GetHealthDisplayType(self)
	return u6[self:GetHumanoid_Check().HealthDisplayType];
end;
function M.Jump(self)
	self:GetHumanoid_Check().Jump = true;
end;
function M.IsJumping(self)
	return self:GetHumanoid_Check().Jump;
end;
function M.SetJumpHeight(self, p51)
	assert(p51, "param height is nil");
	self:GetHumanoid_Check().JumpHeight = p51;
end;
function M.GetJumpHeight(self)
	return self:GetHumanoid_Check().JumpHeight;
end;
function M.SetJumpPower(self, p54)
	assert(p54, "param power is nil");
	self:GetHumanoid_Check().JumpPower = p54;
end;
function M.GetJumpPower(self)
	return self:GetHumanoid_Check().JumpPower;
end;
function M.SetMaxSlopAngle(self, p57)
	assert(p57, "param angle is nil");
	self:GetHumanoid_Check().MaxSlopeAngle = p57;
end;
function M.GetMaxSlopAngle(self)
	return self:GetHumanoid_Check().MaxSlopeAngle;
end;
function M.SetNameDisplayDistance(self, p60)
	assert(p60, "param distance is nil");
	self:GetHumanoid_Check().NameDisplayDistance = p60;
end;
function M.GetNameDisplayDistance(self)
	return self:GetHumanoid_Check().NameDisplayDistance;
end;
local u7 = {
	OccludeAll = 2, 
	EnemyOcclusion = 1, 
	NoOcclusion = 0, 
	[0] = "NoOcclusion",
	"EnemyOcclusion", "OccludeAll"
};
function M.SetNameOcclusion(self, p63)
	assert(p63, "param occlusion type is nil");
	local v5 = u7[p63];
	assert(v5, "no such occlude type");
	self:GetHumanoid_Check().NameOcclusion = v5;
end;
function M.GetnameOcclusion(self)
	return self:GetHumanoid_Check().NameOcclusion;
end;
function M.SetPlatformStand(self, p66)
	if p66 == nil then
		p66 = false;
	end;
	self:GetHumanoid_Check().PlatformStand = p66;
end;
function M.IsPlatformStand(self)
	return self:GetHumanoid_Check().PlatformStand;
end;
function M.SetRequiresNeck(self, p69)
	if p69 == nil then
		p69 = false;
	end;
	self:GetHumanoid_Check().RequiresNeck = p69;
end;
function M.IsRequiresNeck(self)
	return self:GetHumanoid_Check().RequiresNeck;
end;
local u8 = {
	R6 = 0, 
	R15 = 1, 
	[0] = "R6",
	"R15"
};
function M.SetRigType(self, p72)
	assert(p72, "param rig type is nil");
	local v6 = u8[p72];
	assert(v6, "no such rig type");
	self:GetHumanoid_Check().RigType = v6;
end;
function M.GetRigType(self)
	return u8[self:GetHumanoid_Check().RigType];
end;
function M.GetSeatPart(self)
	return self:GetHumanoid_Check().SeatPart;
end;
function M.IsSit(self)
	return self:GetHumanoid_Check().Sit;
end;
function M.GetBottomPosition(self)
	return self:GetPosition() - Vector3.new(0, self:GetHeight(), 0);
end;
function M.SetBottomPosition(self, p78)
	assert(p78, "param position is nil");
	self:SetPosition(p78 + Vector3.new(0, self:GetHeight(), 0));
end;
function M.SetPosition(self, p80)
	assert(p80, "param position is nil");
	local v7 = self:GetHumanoid_Check();
	local v8 = v7:GetStateEnabled(Enum.HumanoidStateType.FallingDown);
	local v9 = v7:GetStateEnabled(Enum.HumanoidStateType.Freefall);
	local v10 = v7:GetStateEnabled(Enum.HumanoidStateType.Flying);
	v7:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false);
	v7:SetStateEnabled(Enum.HumanoidStateType.Freefall, false);
	v7:SetStateEnabled(Enum.HumanoidStateType.Flying, false);
	M.super.SetPosition(self, p80);
	self:AddProcess(function()
		self:Wait();
		v7:SetStateEnabled(Enum.HumanoidStateType.FallingDown, v8);
		v7:SetStateEnabled(Enum.HumanoidStateType.Freefall, v9);
		v7:SetStateEnabled(Enum.HumanoidStateType.Flying, v10);
	end);
end;
function M.WalkTo(self, p82)
	assert(p82, "param position is nil");
	self:GetHumanoid_Check():MoveTo(p82);
end;
function M.TakeDamage(self, p84)
	assert(p84, "param damage is nil");
	self:GetHumanoid_Check():TakeDamage(p84);
end;
function M.UseJumpPower(self, p86)
	if p86 == nil then
		p86 = false;
	end;
	self:GetHumanoid_Check().UseJumpPower = p86;
end;

function M.NeckLookAt(self, pos)
	local Head= self.main_inst:FindFirstChild("Head")
	assert(Head,"Head==nil")
	local neckJoint=Head.Neck
	assert(neckJoint,"neckJoint==nil")

	local upperTorso= neckJoint.Part0
	assert(upperTorso,"upperTorso==nil")

	local goalCF = CFrame.lookAt(Head.Position, pos, upperTorso.CFrame.UpVector)
	neckJoint.C0 = worldCFrameToC0ObjectSpace(neckJoint,goalCF)

end;



return M;
